package edu.tgc.entity.teaching;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnore;

import edu.tgc.entity.system.BaseEntity;
import edu.tgc.entity.system.SysDept;
import edu.tgc.entity.system.SysUser;
@Entity
public class Enroll extends BaseEntity{
	private String name;
	//private Enroll parent;
	private String comment; //说明
	//private double cost;//缴费
	private Date endTime;
	private SysDept dept;
	private SysUser creator;
	@JsonIgnore
	private List<TbParticipant> participants;
	
	@Column(length=50)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	
	@ManyToOne
	public SysDept getDept() {
		return dept;
	}
	public void setDept(SysDept dept) {
		this.dept = dept;
	}
	
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy="enroll")
	public List<TbParticipant> getParticipants() {
		return participants;
	}
	
	public void setParticipants(List<TbParticipant> participants) {
		this.participants = participants;
	}
	@ManyToOne
	public SysUser getCreator() {
		return creator;
	}
	public void setCreator(SysUser creator) {
		this.creator = creator;
	}
	
	@Temporal(value=TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	
	
	
}
